home *** CD-ROM | disk | FTP | other *** search
- {------------------------------DRAW.ORL-------------------------------
- This script lets you draw a variety of graphic shapes by clicking on
- various points in the window.
- --------------------------------------------------------------------}
-
- {Establish Default Environment}
- UseCaption("Oriel Draw")
- SetWindow(Maximize)
- UseCoordinates(Metric)
- UsePen(SOLID,3,0,0,0)
- Set P_Red = 0
- Set P_Green = 0
- Set P_Blue = 0
- UseBrush(SOLID,255,0,0)
- Set Br_Red = 255
- Set Br_Green = 0
- Set Br_Blue = 0
- UseBackground(OPAQUE,255,255,255)
- DrawBackground
- DrawLine(0,130,280,130)
-
- Draw_Menu:
- SetMenu("&Figures",IGNORE,
- "&Line", DR_LINE,
- "&Rectangle", DR_RECTANGLE,
- "&Round Rectangle", DR_ROUNDR,
- "&Ellipse", DR_ELLIPSE,
- "&Pie", DR_PIE,
- "&Arc", DR_ARC,
- "&Chord", DR_CHORD,
- ENDPOPUP,
- "&Brush Color",IGNORE,
- "&White", BRUSH_WHITE,
- "&Gray", BRUSH_GRAY,
- "&Red", BRUSH_RED,
- "&Yellow", BRUSH_YEL,
- "Gree&n", BRUSH_GRN,
- "&Light Blue", BRUSH_LTBLU,
- "&Blue", BRUSH_BLUE,
- "&Pink", BRUSH_PINK,
- "Blac&k", BRUSH_BLACK,
- ENDPOPUP,
- "&Pen Color",IGNORE,
- "&White", Pen_WHITE,
- "&Gray", Pen_GRAY,
- "&Red", Pen_RED,
- "&Yellow", Pen_YEL,
- "Gree&n", Pen_GRN,
- "&Light Blue", Pen_LTBLU,
- "&Blue", Pen_BLUE,
- "&Pink", Pen_PINK,
- "Blac&k", Pen_BLACK,
- ENDPOPUP,
- "&Exit!",Exit_proc,
- ENDPOPUP)
-
-
- {Draw tool boxes}
- Gosub Draw_Boxes
-
- {Highlight the line tool}
- UsePen(SOLID,3,0,0,0)
- UseBrush(NULL,0,0,0)
- Gosub Line_Box
- Set Box_select=1
-
- {Draw tools}
- UseFont("Helv",0,3,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
- UseBrush(SOLID,255,0,0)
- UsePen(SOLID,2,0,0,0)
-
- DrawText(1,1,"1") {Line}
- DrawLine(4,5,22,10)
- DrawText(23,9,"2")
-
- DrawText(31,1,"1") {Rectangle}
- DrawRectangle(34,3,56,12)
- DrawText(57,10,"2")
-
- DrawText(61,1,"1") {Round Rectangle}
- DrawRoundRectangle(64,3,86,12,3,3)
- DrawText(87,10,"2")
-
- UseBrush(NULL,0,0,0) {Ellipse}
- UsePen(DOT,1,0,0,0)
- DrawText(91,1,"1")
- DrawRectangle(94,3,116,12)
- DrawText(116,10,"2")
- UseBrush(SOLID,255,0,0)
- UsePen(SOLID,2,0,0,0)
- DrawEllipse(94,3,116,12)
-
- UseBrush(NULL,0,0,0) {Pie}
- UsePen(DOT,1,0,0,0)
- DrawText(121,1,"1")
- DrawRectangle(124,3,146,12)
- DrawEllipse(124,3,146,12)
- DrawText(146,10,"2")
- UseBrush(SOLID,255,0,0)
- UsePen(SOLID,2,0,0,0)
- DrawPie(124,3,146,12,146,7,126,3)
- DrawText(146,5,"3")
- DrawText(126,0,"4")
-
- UseBrush(NULL,0,0,0) {Arc}
- UsePen(DOT,1,0,0,0)
- DrawText(151,1,"1")
- DrawRectangle(154,3,176,12)
- DrawEllipse(154,3,176,12)
- DrawText(176,10,"2")
- UseBrush(SOLID,255,0,0)
- UsePen(SOLID,2,0,0,0)
- DrawArc(154,3,176,12,176,7,156,3)
- DrawText(176,5,"3")
- DrawText(156,0,"4")
-
- UseBrush(NULL,0,0,0) {Chord}
- UsePen(DOT,1,0,0,0)
- DrawText(181,1,"1")
- DrawRectangle(184,3,206,12)
- DrawEllipse(184,3,206,12)
- DrawText(206,10,"2")
- UseBrush(SOLID,255,0,0)
- UsePen(SOLID,2,0,0,0)
- DrawChord(184,3,206,12,206,7,186,3)
- DrawText(206,5,"3")
- DrawText(186,0,"4")
-
- {Reset the font}
- UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
-
- {Line}
- Dr_Line:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,line2,POS_X,POS_Y)
- Gosub Draw_Blank
- DrawText(25,136,"(1) Click on the beginning of the line")
- WaitInput()
- line2:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,line_end,pos_x1,pos_y1)
- Gosub Draw_Blank
- DrawText(25,136,"(2) Click on the end point of the line")
- WaitInput()
- line_end:
- DrawLine(pos_x,pos_y,pos_x1,pos_y1)
- Goto Dr_Line
-
- {Rectangle}
- dr_rectangle:
- set rec_type = 0
- goto dr_rect
-
- {Round Rectangle}
- dr_roundr:
- set rec_type = 1
- goto dr_rect
-
- Dr_rect:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,rectangle2,POS_X,POS_Y)
- Gosub Draw_Blank
- DrawText(25,136,"(1) Click on the upper-left corner of the rectangle")
- WaitInput()
- rectangle2:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,rect_end,pos_x1,pos_y1)
- Gosub Draw_Blank
- DrawText(25,136,"(2) Click on the lower-right corner of the rectangle")
- WaitInput()
- rect_end:
- if rec_type = 0 then DrawRectangle(pos_x,pos_y,pos_x1,pos_y1) | goto dr_rect
- DrawRoundRectangle(pos_x,pos_y,pos_x1,pos_y1,12,9)
- Goto dr_rect
-
- {Ellipse}
- dr_ellipse:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,ellipse2,POS_X,POS_Y)
- Gosub Draw_Blank
- DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the ellipse")
- WaitInput()
- ellipse2:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,ellipse_end,pos_x1,pos_y1)
- Gosub Draw_Blank
- DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the ellipse")
- WaitInput()
- ellipse_end:
- DrawEllipse(pos_x,pos_y,pos_x1,pos_y1)
- Goto dr_ellipse
-
- {Pie}
- dr_pie:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,pie2,POS_X,POS_Y)
- Gosub Draw_Blank
- DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the pie's ellipse")
- WaitInput()
- pie2:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,pie3,pos_x1,pos_y1)
- Gosub Draw_Blank
- DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the pie's ellipse")
- WaitInput()
- pie3:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,pie4,pos_x2,pos_y2)
- Gosub Draw_Blank
- DrawText(25,136,"(3) Click on one end of the arc that defines the pie")
- WaitInput()
- pie4:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,pie_end,pos_x3,pos_y3)
- Gosub Draw_Blank
- DrawText(25,136,"(4) Click on the other end of the arc that defines the pie")
- WaitInput()
-
- pie_end:
- DrawPie(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
- Goto dr_pie
-
- {Arc}
- dr_arc:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,arc2,POS_X,POS_Y)
- Gosub Draw_Blank
- DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the arc")
- WaitInput()
- arc2:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,arc3,POS_X1,POS_Y1)
- Gosub Draw_Blank
- DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the arc")
- WaitInput()
- arc3:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,arc4,pos_x2,pos_y2)
- Gosub Draw_Blank
- DrawText(25,136,"(3) Click on the arc's start point")
- WaitInput()
- arc4:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,arc_end,pos_x3,pos_y3)
- Gosub Draw_Blank
- DrawText(25,136,"(4) Click on the arc's end point")
- WaitInput()
-
- arc_end:
- DrawArc(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
- Goto dr_arc
-
- {Chord}
- dr_chord:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,chord2,POS_X,POS_Y)
- Gosub Draw_Blank
- DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the chord's ellipse")
- WaitInput()
- chord2:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,chord3,pos_x1,pos_y1)
- Gosub Draw_Blank
- DrawText(25,136,"(2) Click on lower-right corner of the rectangle bounding the chord's ellipse")
- WaitInput()
- chord3:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,chord4,pos_x2,pos_y2)
- Gosub Draw_Blank
- DrawText(25,136,"(3) Click on one point of the line that defines the chord")
- WaitInput()
- chord4:
- SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
- 0,16,60000,130,chord_end,pos_x3,pos_y3)
- Gosub Draw_Blank
- DrawText(25,136,"(4) Click on the second point of the line that defines the chord")
- WaitInput()
-
- chord_end:
- DrawChord(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
- Goto dr_chord
-
- {Change Brush Colors}
- BRUSH_WHITE:
- UseBrush(SOLID,255,255,255)
- Set Br_Red=255
- Set Br_Green=255
- Set Br_Blue=255
- Goto Leave_Box
-
- BRUSH_GRAY:
- UseBrush(SOLID,192,192,192)
- Set Br_Red=192
- Set Br_Green=192
- Set Br_Blue=192
- Goto Leave_Box
-
- BRUSH_RED:
- UseBrush(SOLID,255,0,0)
- Set Br_Red=255
- Set Br_Green=0
- Set Br_Blue=0
- Goto Leave_Box
-
- BRUSH_YEL:
- UseBrush(SOLID,255,255,0)
- Set Br_Red=255
- Set Br_Green=255
- Set Br_Blue=0
- Goto Leave_Box
-
- BRUSH_GRN:
- UseBrush(SOLID,0,255,0)
- Set Br_Red=0
- Set Br_Green=255
- Set Br_Blue=0
- Goto Leave_Box
-
- BRUSH_LTBLU:
- UseBrush(SOLID,0,255,255)
- Set Br_Red=0
- Set Br_Green=255
- Set Br_Blue=255
- Goto Leave_Box
-
- BRUSH_BLUE:
- UseBrush(SOLID,0,0,255)
- Set Br_Red=0
- Set Br_Green=0
- Set Br_Blue=255
- Goto Leave_Box
-
- BRUSH_PINK:
- UseBrush(SOLID,255,0,255)
- Set Br_Red=255
- Set Br_Green=0
- Set Br_Blue=255
- Goto Leave_Box
-
- BRUSH_Black:
- UseBrush(SOLID,0,0,0)
- Set Br_Red=0
- Set Br_Green=0
- Set Br_Blue=0
- Goto Leave_Box
-
- {Change Pen Colors}
- Pen_White:
- UsePen(SOLID,2,255,255,255)
- Set P_Red=255
- Set P_Green=255
- Set P_Blue=255
- Goto Leave_Box
-
- Pen_GRAY:
- UsePen(SOLID,2,192,192,192)
- Set P_Red=192
- Set P_Green=192
- Set P_Blue=192
- Goto Leave_Box
-
- Pen_RED:
- UsePen(SOLID,2,255,0,0)
- Set P_Red=255
- Set P_Green=0
- Set P_Blue=0
- Goto Leave_Box
-
- Pen_YEL:
- UsePen(SOLID,2,255,255,0)
- Set P_Red=255
- Set P_Green=255
- Set P_Blue=0
- Goto Leave_Box
-
- Pen_GRN:
- UsePen(SOLID,2,0,255,0)
- Set P_Red=0
- Set P_Green=255
- Set P_Blue=0
- Goto Leave_Box
-
- Pen_LTBLU:
- UsePen(SOLID,2,0,255,255)
- Set P_Red=0
- Set P_Green=255
- Set P_Blue=255
- Goto Leave_Box
-
- Pen_BLUE:
- UsePen(SOLID,2,0,0,255)
- Set P_Red=0
- Set P_Green=0
- Set P_Blue=255
- Goto Leave_Box
-
- Pen_PINK:
- UsePen(SOLID,2,255,0,255)
- Set P_Red=255
- Set P_Green=0
- Set P_Blue=255
- Goto Leave_Box
-
- Pen_Black:
- UsePen(SOLID,2,0,0,0)
- Set P_Red=0
- Set P_Green=0
- Set P_Blue=0
- Goto Leave_Box
-
- {Subroutine to erase current text}
- Draw_Blank:
- UsePen(NULL,1,0,0,0)
- UseBrush(SOLID,255,255,255)
- DrawRectangle(25,136,250,145)
- UsePen(SOLID,2,P_Red,P_Green,P_Blue)
- UseBrush(SOLID,Br_Red,Br_Green,Br_Blue)
- Return
-
- {Move the highlight to the selected tool}
- Move_Hilite:
- Set Box_Select_Old = Box_Select
- UseBrush(NULL,0,0,0)
-
- {Erase the old highlight}
- UsePen(SOLID,3,255,255,255) {White pen}
- If Box_Select_Old = 1 Then Gosub Line_Box | Goto New_Hilite
- If Box_Select_Old = 2 Then Gosub Rect_Box | Goto New_Hilite
- If Box_Select_Old = 3 Then Gosub RoundRect_Box | Goto New_Hilite
- If Box_Select_Old = 4 Then Gosub Ellipse_Box | Goto New_Hilite
- If Box_Select_Old = 5 Then Gosub Pie_Box | Goto New_Hilite
- If Box_Select_Old = 6 Then Gosub Arc_Box | Goto New_Hilite
- {Else} Gosub Chord_Box
-
- {Draw the new highlight}
- New_Hilite:
- UsePen(SOLID,3,0,0,0) {Black pen}
- If POS_X <= 30 Then Set Box_Select=1 | Gosub Line_Box | Goto Leave_Box
- If POS_X <= 60 Then Set Box_Select=2 | Gosub Rect_Box | Goto Leave_Box
- If POS_X <= 90 Then Set Box_Select=3 | Gosub RoundRect_Box | Goto Leave_Box
- If POS_X <= 120 Then Set Box_Select=4 | Gosub Ellipse_Box | Goto Leave_Box
- If POS_X <= 150 Then Set Box_Select=5 | Gosub Pie_Box | Goto Leave_Box
- If POS_X <= 180 Then Set Box_Select=6 | Gosub Arc_Box | Goto Leave_Box
- {Else} Set Box_Select=7 | Gosub Chord_Box
-
- {Reset the brush and pen and branch to the appropriate routine}
- Leave_Box:
- Gosub Draw_Boxes
- If Box_Select = 1 Then Goto Dr_Line
- If Box_Select = 2 Then Goto Dr_Rectangle
- If Box_Select = 3 Then Goto Dr_RoundR
- If Box_Select = 4 Then Goto Dr_Ellipse
- If Box_Select = 5 Then Goto Dr_Pie
- If Box_Select = 6 Then Goto Dr_Arc
- {Else} Goto Dr_Chord
-
- {Exit!}
- Exit_Proc:
- End
-
- {Subroutines for highligting drawing tools}
- Line_Box:
- DrawRectangle(0,0,30,16)
- Return
-
- Rect_Box:
- DrawRectangle(30,0,60,16)
- Return
-
- RoundRect_Box:
- DrawRectangle(60,0,90,16)
- Return
-
- Ellipse_Box:
- DrawRectangle(90,0,120,16)
- Return
-
- Pie_Box:
- DrawRectangle(120,0,150,16)
- Return
-
- Arc_Box:
- DrawRectangle(150,0,180,16)
- Return
-
- Chord_Box:
- DrawRectangle(180,0,210,16)
- Return
-
- {Draw tool boxes}
- Draw_Boxes:
- UsePen(SOLID,2,0,0,0)
- DrawLine(0,16,1000,16) {Solid line across the window}
- UsePen(SOLID,1,0,0,0) {Lines between drawing tools}
- DrawLine(30,0,30,16)
- DrawLine(60,0,60,16)
- DrawLine(90,0,90,16)
- DrawLine(120,0,120,16)
- DrawLine(150,0,150,16)
- DrawLine(180,0,180,16)
- {Reset the pen and brush}
- UsePen(SOLID,2,P_Red,P_Green,P_Blue)
- UseBrush(SOLID,Br_Red,Br_Green,Br_Blue)
- Return